#include <devices.h>

#include <console.h>
#include <clock.h>
#include <intr.h>
#include <ide.h>
#include <um.h>
#include <memlayout.h>

struct _device_common *device_common;

/**
 * Finish common initializing tasks which are needed for both processes.
 */
void
device_init_common (void)
{
	cons_init ();
	intr_init ();
	ide_init ();
}

void
device_init_post (void)
{
	clock_init ();
}


/**
 * Carry out tracing-process specific initializing work.
 * @param cpid pid of the child process.
 */
void
device_init_tracing_process (int cpid)
{
	//device_common->cpid = cpid;
	
	/* Initialize shared memory. */
	//device_common->cons_front = device_common->cons_end = 0;
}


/**
 * Carry out child-process specific initializing work
 */
void
device_init_child_process (void)
{
	/* 'setitimer' sets the timer of the calling process.
	 *     so clock must be initialized in child process.
	 */
	clock_init ();
}


/**
 * Finalize devices if needed.
 */
void
device_dtor (void)
{
	cons_dtor ();
}
